home *** CD-ROM | disk | FTP | other *** search
/ PC World Komputer 2010 April / PCWorld0410.iso / pluginy Firefox / 12984 / 12984.xpi / chrome / VideoDownloaderToolbar.jar / content / EditProfile.js < prev    next >
Text File  |  2010-01-29  |  953b  |  36 lines

  1. if(!com) var com={};
  2. if(!com.VidBar) com.VidBar={};
  3.  
  4. com.VidBar.EditProfile = function() {}
  5.  
  6. com.VidBar.EditProfile.prototype = {
  7.     profile : null,
  8.     onLoad : function(event){
  9.         this.profile = new com.VidBar.Profile();
  10.         this.profile.load();
  11.         var edits = document.getElementsByTagName("textbox");
  12.         for(var i=0;i<edits.length;i++){
  13.             if(edits[i].getAttribute("afid")){
  14.                 var afid = edits[i].getAttribute("afid");
  15.                 if(afid in this.profile.fieldValues){
  16.                     edits[i].value = this.profile.fieldValues[afid]; 
  17.                 }
  18.             }
  19.         }
  20.     },
  21.     onUnload : function(event){
  22.     },
  23.     onAccept : function(){
  24.         var edits = document.getElementsByTagName("textbox");
  25.         for(var i=0;i<edits.length;i++){
  26.             if(edits[i].getAttribute("afid")){
  27.                 var afid = edits[i].getAttribute("afid");
  28.                 if(afid in this.profile.fieldValues){
  29.                     this.profile.fieldValues[afid] = edits[i].value; 
  30.                 }
  31.             }
  32.         }
  33.         this.profile.save();
  34.         return true;
  35.     }
  36. };